; ModuleID = 'count.c'
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32"
target triple = "i386-pc-linux-gnu"

%struct.MPI_Status = type { i32, i32, i32, i32, i32 }
%struct.ompi_communicator_t = type opaque
%struct.ompi_datatype_t = type opaque
%struct.ompi_predefined_communicator_t = type opaque
%struct.ompi_predefined_datatype_t = type opaque

@ompi_mpi_comm_world = external global %struct.ompi_predefined_communicator_t
@ompi_mpi_float = external global %struct.ompi_predefined_datatype_t
@.str = private constant [7 x i8] c"%3.1f \00", align 1

define i32 @main(i32 %argc, i8** %argv) nounwind {
entry:
  %argc_addr = alloca i32, align 4
  %argv_addr = alloca i8**, align 4
  %retval = alloca i32
  %vector = alloca [100 x float]
  %status = alloca %struct.MPI_Status
  %p = alloca i32
  %my_rank = alloca i32
  %i = alloca i32
  %"alloca point" = bitcast i32 0 to i32
  store i32 %argc, i32* %argc_addr
  store i8** %argv, i8*** %argv_addr
  %0 = call i32 @MPI_Init(i32* %argc_addr, i8*** %argv_addr) nounwind
  %1 = call i32 @MPI_Comm_size(%struct.ompi_communicator_t* bitcast (%struct.ompi_predefined_communicator_t* @ompi_mpi_comm_world to %struct.ompi_communicator_t*), i32* %p) nounwind
  %2 = call i32 @MPI_Comm_rank(%struct.ompi_communicator_t* bitcast (%struct.ompi_predefined_communicator_t* @ompi_mpi_comm_world to %struct.ompi_communicator_t*), i32* %my_rank) nounwind
  %3 = load i32* %my_rank, align 4
  %4 = icmp eq i32 %3, 0
  br i1 %4, label %bb, label %bb8

bb:                                               ; preds = %entry
  store i32 0, i32* %i, align 4
  br label %bb2

bb1:                                              ; preds = %bb2
  %5 = load i32* %i, align 4
  %6 = getelementptr inbounds [100 x float]* %vector, i32 0, i32 %5
  store float 0.000000e+00, float* %6, align 4
  %7 = load i32* %i, align 4
  %8 = add nsw i32 %7, 1
  store i32 %8, i32* %i, align 4
  br label %bb2

bb2:                                              ; preds = %bb1, %bb
  %9 = load i32* %i, align 4
  %10 = icmp sle i32 %9, 49
  br i1 %10, label %bb1, label %bb3

bb3:                                              ; preds = %bb2
  store i32 50, i32* %i, align 4
  br label %bb5

bb4:                                              ; preds = %bb5
  %11 = load i32* %i, align 4
  %12 = getelementptr inbounds [100 x float]* %vector, i32 0, i32 %11
  store float 1.000000e+00, float* %12, align 4
  %13 = load i32* %i, align 4
  %14 = add nsw i32 %13, 1
  store i32 %14, i32* %i, align 4
  br label %bb5

bb5:                                              ; preds = %bb4, %bb3
  %15 = load i32* %i, align 4
  %16 = icmp sle i32 %15, 99
  br i1 %16, label %bb4, label %bb6

bb6:                                              ; preds = %bb5
  %vector7 = bitcast [100 x float]* %vector to float*
  %17 = getelementptr inbounds float* %vector7, i32 50
  %18 = bitcast float* %17 to i8*
  %19 = call i32 @MPI_Send(i8* %18, i32 50, %struct.ompi_datatype_t* bitcast (%struct.ompi_predefined_datatype_t* @ompi_mpi_float to %struct.ompi_datatype_t*), i32 1, i32 0, %struct.ompi_communicator_t* bitcast (%struct.ompi_predefined_communicator_t* @ompi_mpi_comm_world to %struct.ompi_communicator_t*)) nounwind
  br label %bb13

bb8:                                              ; preds = %entry
  %vector9 = bitcast [100 x float]* %vector to float*
  %20 = getelementptr inbounds float* %vector9, i32 50
  %21 = bitcast float* %20 to i8*
  %22 = call i32 @MPI_Recv(i8* %21, i32 50, %struct.ompi_datatype_t* bitcast (%struct.ompi_predefined_datatype_t* @ompi_mpi_float to %struct.ompi_datatype_t*), i32 0, i32 0, %struct.ompi_communicator_t* bitcast (%struct.ompi_predefined_communicator_t* @ompi_mpi_comm_world to %struct.ompi_communicator_t*), %struct.MPI_Status* %status) nounwind
  store i32 50, i32* %i, align 4
  br label %bb11

bb10:                                             ; preds = %bb11
  %23 = load i32* %i, align 4
  %24 = getelementptr inbounds [100 x float]* %vector, i32 0, i32 %23
  %25 = load float* %24, align 4
  %26 = fpext float %25 to double
  %27 = call i32 (i8*, ...)* @printf(i8* noalias getelementptr inbounds ([7 x i8]* @.str, i32 0, i32 0), double %26) nounwind
  %28 = load i32* %i, align 4
  %29 = add nsw i32 %28, 1
  store i32 %29, i32* %i, align 4
  br label %bb11

bb11:                                             ; preds = %bb10, %bb8
  %30 = load i32* %i, align 4
  %31 = icmp sle i32 %30, 99
  br i1 %31, label %bb10, label %bb12

bb12:                                             ; preds = %bb11
  %32 = call i32 @putchar(i32 10) nounwind
  br label %bb13

bb13:                                             ; preds = %bb12, %bb6
  %33 = call i32 @MPI_Finalize() nounwind
  br label %return

return:                                           ; preds = %bb13
  %retval14 = load i32* %retval
  ret i32 %retval14
}

declare i32 @MPI_Init(i32*, i8***)

declare i32 @MPI_Comm_size(%struct.ompi_communicator_t*, i32*)

declare i32 @MPI_Comm_rank(%struct.ompi_communicator_t*, i32*)

declare i32 @MPI_Send(i8*, i32, %struct.ompi_datatype_t*, i32, i32, %struct.ompi_communicator_t*)

declare i32 @MPI_Recv(i8*, i32, %struct.ompi_datatype_t*, i32, i32, %struct.ompi_communicator_t*, %struct.MPI_Status*)

declare i32 @printf(i8* noalias, ...) nounwind

declare i32 @putchar(i32)

declare i32 @MPI_Finalize()
